package com.bw.lib_mvicore.model

import androidx.lifecycle.ViewModel
import com.bw.lib_mvicore.IIntent
import kotlinx.coroutines.channels.Channel

/**
 * @Author : ZhouZiYao
 * @Time : On 2023/11/17 16:02
 * @Description :
 */
abstract class BaseModel<I: IIntent>: ViewModel(), IModel<I> {
    //实例化通道对象
    private val _intents = Channel<I>(Channel.UNLIMITED)
    //重写父类的intents属性
    override val intents: Channel<I>
        get() = _intents

    //处理意图
    init {
        handleIntent()
    }

    abstract fun handleIntent()

}